package com.task.common.enums;

/**
 * 系统操作类型
 *
 * @author Huzz
 * @created 2021-12-08 14:18
 */
public enum OperatorType {

    OTHER(2,"其他"),

    PC(0,"PC端"),

    MOBILE(1,"移动端"),

    ;

    private Integer code;

    private String value;

    OperatorType(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public Integer getCode(){
        return code;
    }

    /**
     * 根据code取值
     * @param code
     * @return
     */
    public String getValueByCode(Integer code){
        for (OperatorType val : values()) {
            if (val.getCode().equals(code)) {
                return val.getValue();
            }
        }
        return null;
    }

}
